package hamsterwrench.gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.FlowLayout;
import javax.swing.JLabel;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.JTextField;
import javax.swing.JTabbedPane;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import com.jgoodies.forms.factories.FormFactory;
import javax.swing.JCheckBox;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import javax.swing.SpringLayout;
import java.awt.GridLayout;
import javax.swing.JSlider;
import javax.swing.JFormattedTextField;

public class HeroEditor extends JFrame {

	private JPanel contentPane;
	private JTextField textField;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					HeroEditor frame = new HeroEditor();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public HeroEditor() {
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 516, 612);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.NORTH);
		panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		JLabel lblHeroNo = new JLabel("Hero No.");
		panel.add(lblHeroNo);
		
		JSpinner spinner = new JSpinner();
		spinner.setModel(new SpinnerNumberModel(new Integer(0), new Integer(0), null, new Integer(1)));
		panel.add(spinner);
		
		JLabel lblName = new JLabel("Name:");
		panel.add(lblName);
		
		textField = new JTextField();
		panel.add(textField);
		textField.setColumns(16);
		
		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		tabbedPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
		contentPane.add(tabbedPane, BorderLayout.CENTER);
		
		JPanel appearance = new JPanel();
		tabbedPane.addTab("Appearance", null, appearance, null);
		
		JPanel stat = new JPanel();
		tabbedPane.addTab("Stats", null, stat, null);
		stat.setLayout(new GridLayout(0, 2, 0, 0));
		
		JPanel lv0 = new JPanel();
		lv0.setBorder(new TitledBorder(null, "Level Zero", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		stat.add(lv0);
		lv0.setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("center:max(32dlu;default)"),
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("left:max(25dlu;default):grow"),},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,}));
		
		JLabel lblHp0 = new JLabel("HP");
		lv0.add(lblHp0, "2, 2");
		
		JSlider HPslider0 = new JSlider();
		HPslider0.setMajorTickSpacing(1000);
		HPslider0.setPaintTicks(true);
		lblHp0.setLabelFor(HPslider0);
		HPslider0.setMinorTickSpacing(500);
		HPslider0.setMaximum(9999);
		HPslider0.setValue(0);
		lv0.add(HPslider0, "4, 2, center, default");
		
		JSpinner spinner_5 = new JSpinner();
		spinner_5.setModel(new SpinnerNumberModel(0, 0, 9999, 1));
		lv0.add(spinner_5, "6, 2");
		
		JLabel lblMp0 = new JLabel("MP");
		lv0.add(lblMp0, "2, 4");
		
		JSlider MPSlider0 = new JSlider();
		MPSlider0.setPaintTicks(true);
		MPSlider0.setMajorTickSpacing(1000);
		MPSlider0.setValue(0);
		MPSlider0.setMinorTickSpacing(500);
		MPSlider0.setMaximum(9999);
		lv0.add(MPSlider0, "4, 4");
		
		JLabel lblAtk = new JLabel("Atk");
		lv0.add(lblAtk, "2, 6");
		
		JSlider AtkSlider0 = new JSlider();
		AtkSlider0.setPaintTicks(true);
		AtkSlider0.setMajorTickSpacing(100);
		AtkSlider0.setValue(0);
		AtkSlider0.setMinorTickSpacing(50);
		AtkSlider0.setMaximum(999);
		lv0.add(AtkSlider0, "4, 6");
		
		JLabel lblAim = new JLabel("Aim");
		lv0.add(lblAim, "2, 8");
		
		JSlider slider_2 = new JSlider();
		slider_2.setValue(0);
		slider_2.setPaintTicks(true);
		slider_2.setMinorTickSpacing(50);
		slider_2.setMaximum(999);
		slider_2.setMajorTickSpacing(100);
		lv0.add(slider_2, "4, 8");
		
		JLabel lblDef = new JLabel("Def");
		lv0.add(lblDef, "2, 10");
		
		JSlider slider_3 = new JSlider();
		slider_3.setValue(0);
		slider_3.setPaintTicks(true);
		slider_3.setMinorTickSpacing(50);
		slider_3.setMaximum(999);
		slider_3.setMajorTickSpacing(100);
		lv0.add(slider_3, "4, 10");
		
		JLabel lblDog = new JLabel("Dog");
		lv0.add(lblDog, "2, 12");
		
		JSlider slider_4 = new JSlider();
		slider_4.setValue(0);
		slider_4.setPaintTicks(true);
		slider_4.setMinorTickSpacing(50);
		slider_4.setMaximum(999);
		slider_4.setMajorTickSpacing(100);
		lv0.add(slider_4, "4, 12");
		
		JLabel lblMag = new JLabel("Mag");
		lv0.add(lblMag, "2, 14");
		
		JSlider slider_5 = new JSlider();
		slider_5.setValue(0);
		slider_5.setPaintTicks(true);
		slider_5.setMinorTickSpacing(50);
		slider_5.setMaximum(999);
		slider_5.setMajorTickSpacing(100);
		lv0.add(slider_5, "4, 14");
		
		JLabel lblWil = new JLabel("Wil");
		lv0.add(lblWil, "2, 16");
		
		JSlider slider_6 = new JSlider();
		slider_6.setValue(0);
		slider_6.setPaintTicks(true);
		slider_6.setMinorTickSpacing(50);
		slider_6.setMaximum(999);
		slider_6.setMajorTickSpacing(100);
		lv0.add(slider_6, "4, 16");
		
		JLabel lblSpd = new JLabel("Spd");
		lv0.add(lblSpd, "2, 18");
		
		JSlider slider_7 = new JSlider();
		slider_7.setValue(0);
		slider_7.setPaintTicks(true);
		slider_7.setMinorTickSpacing(50);
		slider_7.setMaximum(999);
		slider_7.setMajorTickSpacing(100);
		lv0.add(slider_7, "4, 18");
		
		JLabel lblCtr = new JLabel("Ctr");
		lv0.add(lblCtr, "2, 20");
		
		JSlider slider_8 = new JSlider();
		slider_8.setValue(0);
		slider_8.setPaintTicks(true);
		slider_8.setMinorTickSpacing(50);
		slider_8.setMaximum(999);
		slider_8.setMajorTickSpacing(100);
		lv0.add(slider_8, "4, 20");
		
		JLabel lblMp_1 = new JLabel("MP~");
		lv0.add(lblMp_1, "2, 22");
		
		JSlider slider_9 = new JSlider();
		slider_9.setPaintTicks(true);
		slider_9.setMajorTickSpacing(25);
		slider_9.setValue(0);
		slider_9.setMinorTickSpacing(5);
		lv0.add(slider_9, "4, 22");
		
		JLabel lblHits = new JLabel("Hits");
		lv0.add(lblHits, "2, 24");
		
		JSlider slider_10 = new JSlider();
		slider_10.setPaintTicks(true);
		slider_10.setSnapToTicks(true);
		slider_10.setMinorTickSpacing(1);
		slider_10.setMajorTickSpacing(5);
		slider_10.setValue(0);
		slider_10.setMaximum(10);
		lv0.add(slider_10, "4, 24");
		
		JPanel spellLists = new JPanel();
		tabbedPane.addTab("Spell Lists", null, spellLists, null);
		
		JPanel bitsets = new JPanel();
		tabbedPane.addTab("Bitsets", null, bitsets, null);
		bitsets.setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,}));
		
		JCheckBox chckbxNewCheckBox = new JCheckBox("Rename when added to party");
		bitsets.add(chckbxNewCheckBox, "2, 2");
		
		JCheckBox chckbxPermitRenamingOn = new JCheckBox("Permit renaming on Status screen");
		bitsets.add(chckbxPermitRenamingOn, "2, 4");
		
		JCheckBox chckbxDontShowSpell = new JCheckBox("Don't show spell lists if empty");
		bitsets.add(chckbxDontShowSpell, "2, 6");
		
		JPanel elementalResist = new JPanel();
		tabbedPane.addTab("Elemental Resistances", null, elementalResist, null);
		elementalResist.setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("default:grow"),
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.MIN_COLSPEC,},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				RowSpec.decode("fill:default"),}));
		
		JPanel panel_1 = new JPanel();
		elementalResist.add(panel_1, "2, 2, fill, fill");
		panel_1.setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,}));
		
		JLabel lblResistanceTo = new JLabel("Resistance to ####:");
		panel_1.add(lblResistanceTo, "2, 2");
		
		JSpinner spinner_4 = new JSpinner();
		panel_1.add(spinner_4, "4, 2");
		
		JLabel label = new JLabel("%");
		panel_1.add(label, "6, 2");
		
		JPanel heroTags = new JPanel();
		tabbedPane.addTab("Hero Tags", null, heroTags, null);
		heroTags.setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,}));
		
		JCheckBox chckbxHaveHero = new JCheckBox("Have Hero:");
		heroTags.add(chckbxHaveHero, "2, 2");
		
		JSpinner have_hero = new JSpinner();
		have_hero.setModel(new SpinnerNumberModel(2, 2, 999, 1));
		heroTags.add(have_hero, "4, 2");
		
		JLabel lbltagName = new JLabel("(Tag Name)");
		heroTags.add(lbltagName, "6, 2");
		
		JCheckBox chckbxIsAlive = new JCheckBox("Is Alive:");
		heroTags.add(chckbxIsAlive, "2, 4");
		
		JSpinner spinner_1 = new JSpinner();
		spinner_1.setModel(new SpinnerNumberModel(2, 2, 999, 1));
		heroTags.add(spinner_1, "4, 4");
		
		JLabel lbltagName_1 = new JLabel("(Tag Name)");
		heroTags.add(lbltagName_1, "6, 4");
		
		JCheckBox chckbxIsLeader = new JCheckBox("Is Leader:");
		heroTags.add(chckbxIsLeader, "2, 6");
		
		JSpinner spinner_2 = new JSpinner();
		spinner_2.setModel(new SpinnerNumberModel(2, 2, 999, 1));
		heroTags.add(spinner_2, "4, 6");
		
		JLabel lbltagName_2 = new JLabel("(Tag Name)");
		heroTags.add(lbltagName_2, "6, 6");
		
		JCheckBox chckbxIsInParty = new JCheckBox("Is In Party:");
		heroTags.add(chckbxIsInParty, "2, 8");
		
		JSpinner spinner_3 = new JSpinner();
		spinner_3.setModel(new SpinnerNumberModel(2, 2, 999, 1));
		heroTags.add(spinner_3, "4, 8");
		
		JLabel lbltagName_3 = new JLabel("(Tag Name)");
		heroTags.add(lbltagName_3, "6, 8");
		
		JPanel equipment = new JPanel();
		tabbedPane.addTab("Equipment", null, equipment, null);
		equipment.setLayout(new BorderLayout(0, 0));
		
		JTabbedPane tabbedPane_1 = new JTabbedPane(JTabbedPane.TOP);
		equipment.add(tabbedPane_1, BorderLayout.CENTER);
		
		JPanel weapon = new JPanel();
		tabbedPane_1.addTab("Weapon", null, weapon, null);
		
		JPanel slot1 = new JPanel();
		tabbedPane_1.addTab("Head", null, slot1, null);
		
		JPanel slot2 = new JPanel();
		tabbedPane_1.addTab("Body", null, slot2, null);
		
		JPanel slot3 = new JPanel();
		tabbedPane_1.addTab("Arms", null, slot3, null);
		
		JPanel slot4 = new JPanel();
		tabbedPane_1.addTab("Legs", null, slot4, null);
	}

}
